package cn.com.bsoft.mobile.test

import cn.jiguang.common.ClientConfig
import cn.jpush.api.JPushClient
import cn.jpush.api.push.model.Message
import cn.jpush.api.push.model.Platform
import cn.jpush.api.push.model.PushPayload
import cn.jpush.api.push.model.audience.Audience
import cn.jpush.api.push.model.notification.AndroidNotification
import cn.jpush.api.push.model.notification.Notification
import cn.jpush.api.push.model.notification.PlatformNotification
import cn.net.xyan.blossom.kotlin.json
import com.turo.pushy.apns.util.TokenUtil
import org.junit.Test

class JPushTest{

    //@Test
    fun test1(){
        val jpushClient = JPushClient("f68219685f0ec2194761b35d", "382dc3ad7ba5311901ee9281",
                null, ClientConfig.getInstance())


        val payload = PushPayload.newBuilder()
                .setPlatform(Platform.android())
                .setAudience(Audience.registrationId("170976fa8a84844487b"))
                .setNotification(Notification
                        .newBuilder ()
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert("哇哈哈哈")
                                .setTitle("啦啦啦啦")
                                .addExtras(mapOf("bbb" to "ccc"))
                                .build())
                        .build()
                )
                .setMessage(Message.newBuilder()
                        .setTitle("哇哈哈")
                        .setMsgContent("lalala")
                        .build())
                .build()

        val result = jpushClient.sendPush(payload)

        println(result.json)
    }
}